package homework_java;
import java.io.ObjectStreamException;
import java.util.*;

public class RandomInteger
{
    private Integer intArray[];
    {
        Random random1=new Random();
        int lenth=random1.nextInt(5+1)+15-5;
        System.out.println("length "+lenth);
        intArray=new Integer[lenth];
        System.out.println("排序前的数组");
        for(int i=0;i<lenth;i++)
        {
            //int r=(int)Math.random()*15;
            Random random=new Random();
            int r=random.nextInt(5+1)+15-20;
            intArray[i]=r;
            System.out.println(intArray[i]);
        }
    }
    public static void main(String[] args)
    {
        RandomInteger r=new RandomInteger();
        Arrays.sort(r.intArray);
        System.out.println("排序后");
        for(int i:r.intArray)
        {
            System.out.println(i);
        }
    }
}
